//
//  MyScrollView.m
//  Practice--Album
//
//  Created by 冀永金 on 16/7/20.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "MyScrollView.h"

@implementation MyScrollView
- (instancetype)initWithFrame:(CGRect)frame images:(NSArray<UIImage *> *)images {
    self = [super initWithFrame:frame];
    if (self) {
        [self configWithFrame:frame images:images];
    }
    return self;
}
- (void)configWithFrame:(CGRect )frame images:(NSArray <UIImage *> *)images {
    self.contentSize = CGSizeMake(frame.size.width * images.count, 0);
    for (int i = 0; i < images.count; i ++) {
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(frame.size.width * i, 0, frame.size.width, frame.size.width)];
        [self addSubview:imageView];
        imageView.image = images[i];
    }
    
    self.pagingEnabled = YES;
    self.bounces = YES;
    self.showsVerticalScrollIndicator = NO;
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
